/*
 * mainwindow.h - main window - main layout
 * created date: 8/6/2009
 *
 * Copyright (C) 2009-2010 Jakub Zelenka.
 *
 * Bmin is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * Bmin is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Bmin; if not, see <http://www.gnu.org/licenses/>.
 */

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QMessageBox>
#include <QSettings>

class ControlWidget;
class ModeWidget;
class GUIManager;

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    // timeout for status bar messages generated by this window
    static const int MSG_TIMEOUT = 4000;

    // creates menu actions
    void createActions();
    // create menus
    void createMenus();

    // menu actions
    QAction *m_newAction;
    QAction *m_editAction;
    QAction *m_openAction;
    QAction *m_saveAsAction;
    QAction *m_loadAction;
    QAction *m_storeAction;
    QAction *m_exitAction;
    QAction *m_aboutAction;
    //QAction *m_helpAction;

    // menus
    QMenu *m_fileMenu;
    QMenu *m_helpMenu;

    // settings
    QSettings m_settings;

    // top widget
    ControlWidget *m_control;
    // central widget
    ModeWidget *m_mode;
    // gui manager
    GUIManager *m_gm;

public slots:
    // selects formula from opened formulas
    void selectFormula(unsigned count);

    // sets new cursor
    void setNewCursor(const QCursor &cursor);

    // status bar msg
    void setStatusMsg(const QString &msg, int timeout);

    // Message's slots
    void showMsg(const QString &msg, const QString &title, QMessageBox::Icon iconType);
    // error msg
    void showError(const QString &msg);
    // warning msg
    void showWarning(const QString &msg);
    // info msg
    void showInfo(const QString &msg);

private slots:
    // slots for menu
    // FILE
    void newFormula();
    void editFormula();
    void openFormula();
    void loadFormula();
    void storeFormula();
    void saveAsFormula();
    // HELP
    //void help();
    void about();

    // enabling or disabling edit action
    void enableActs();

};

#endif // MAINWINDOW_H
